Product Code Database
Example Keywords: underpants -the $59
   » » Wiki: Code As Data
Tag Wiki 'Code As Data'.
Tag

Code as data
 ( ) 

Rank: 100%
Bluestar Bluestar Bluestar Bluestar Blackstar

In computer science, the expression code as data refers to the idea that written in a programming language can be manipulated as data, such as a sequence of characters or an abstract syntax tree (AST), and it has an execution semantics only in the context of a given or interpreter. The notion is often used in the context of Lisp-like languages that use as their main syntax, as writing programs using nested lists of symbols makes the interpretation of the program as an AST quite transparent (a property known as ).

(2006). 9781595932372

These ideas are generally used in the context of what is called , writing programs that treat other programs as their data.

(2026). 9781430230663
For example, code-as-data allows the of first-class functions in a portable manner. Another use case is storing a program in a string, which is then processed by a compiler to produce an executable. More often there is a reflection API that exposes the structure of a program as an object within the language, reducing the possibility of creating a malformed program.
(2026). 9781430272311

In computational theory, Kleene's second recursion theorem provides a form of code-is-data, by proving that a program can have access to its own source code.

Code-as-data is also a principle of the Von Neumann architecture, since and data are both represented as bits in the same memory device. This architecture offers the ability to write self-modifying code. It also opens the security risk of disguising a malicious program as user data and then using an exploit to direct execution to the malicious program.


Data as Code
In declarative programming, the data as code (DaC) principle refers to the idea that an arbitrary can be exposed using a specialized language semantics or API. For example, a list of integers or a string is data, but in languages such as Lisp and Perl, they can be directly entered and evaluated as code. Configuration scripts, domain-specific languages and are cases where program execution is controlled by data elements that are not clearly sequences of commands.

Page 1 of 1
1
Page 1 of 1
1

Account

Social:
Pages:  ..   .. 
Items:  .. 

Navigation

General: Atom Feed Atom Feed  .. 
Help:  ..   .. 
Category:  ..   .. 
Media:  ..   .. 
Posts:  ..   ..   .. 

Statistics

Page:  .. 
Summary:  .. 
1 Tags
10/10 Page Rank
5 Page Refs